<template>
  <div class="app-container">
    <Find :OriginalFilter="{ static: true }" :formList="formList" />
    <div class="container mt24">
      <el-card shadow="never" :body-style="{ padding: '12px 20px 12px' }" style="margin-right: 20px">
        <div slot="header" class="mb9 f16">
          <span style="font-weight: 600">用量明细资料</span>
        </div>
        <Table :tableData="tableData" :tableHeader="tableHeader" :TableHeight="45" />

        <div class="mt15 f12 mb36">
          <span class="mr10">材料名称</span
          ><el-input class="mr55" v-model="materialNameVal" placeholder="" size="default" clearable @change="" style="width: 331px"></el-input>
          <span class="mr10">备注</span
          ><el-input v-model="remarkVal" placeholder="" size="default" clearable @change="" style="width: 331px"></el-input>
        </div>

        <el-card shadow="never" :body-style="{ padding: '0px' }">
          <div slot="header" class="mb9 f16">
            <span style="font-weight: 600">贴合子材料明细</span>
          </div>
          <Table :tableData="tableData2" :tableHeader="tableHeader2" :TableHeight="28" />

          <!-- 分页器 -->
          <div class="bottom">
            <span class="total">共{{ total }}项数据</span>
            <el-pagination
              v-model:current-page="currentPage"
              v-model:page-size="pageSize"
              :page-sizes="[10, 20, 30, 40]"
              layout="sizes, prev, pager, next, jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
            <div>
              <el-button class="save" type="primary" size="default" @click="">保存</el-button>
              <el-button type="primary" size="default" @click="">打印</el-button>
            </div>
          </div>
        </el-card>
      </el-card>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
import JMessage from '@/utils/JMessage'
export default defineComponent({
  name: 'TypeBOMQueryKa'
})
</script>
<script lang="ts" setup>
import { i18n, Jzhcn } from '@/i18n'
const formList = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入颜色',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入部位',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入业务物料编码',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入材料名称',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入规格',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '导出'
  }
])

const tableHeader = ref([
  {
    label: '型体',
    prop: 'customer'
  },
  {
    label: '颜色',
    prop: 'color'
  },
  {
    label: '序号',
    prop: 'serialNumber'
  },
  {
    label: '部位',
    prop: 'part'
  },
  {
    label: '分段',
    prop: 'section'
  },
  {
    label: '分类名称',
    prop: 'classificationName'
  },
  {
    label: '物料编码',
    prop: 'materialCode'
  },
  {
    label: '材料名称',
    prop: 'materialName'
  },
  {
    label: '规格',
    prop: 'specification'
  },
  {
    label: '单位',
    prop: 'unit'
  },
  {
    label: '尺码启',
    prop: 'sizeStart'
  },
  {
    label: '尺码止',
    prop: 'sizeEnd'
  },
  {
    label: '厂商',
    prop: 'manufacturer'
  },
  {
    label: '用量',
    prop: 'dosage'
  },
  {
    type: 'select',
    label: '计算方式',
    prop: 'calculationMethod'
  }
])
const tableData = ref([
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  },
  {
    customer: '2023-5-5002',
    color: 'red',
    serialNumber: '222222',
    part: '部位1',
    section: '分段1',
    classificationName: '分类名称1',
    materialCode: '物料编码1',
    materialName: '材料名称1',
    specification: '规格1',
    unit: '单位1',
    sizeStart: '尺码启1',
    sizeEnd: '尺码止1',
    manufacturer: '厂商1',
    dosage: '用量1',
    calculationMethod: {
      selectValue: 'option1',
      options: [
        {
          key: '1',
          label: 'option1',
          value: '111111'
        },
        {
          key: '2',
          label: 'option2',
          value: '22222222222'
        }
      ]
    }
  }
])

const materialNameVal = ref('')
const remarkVal = ref('')

const tableHeader2 = ref([
  {
    label: '物料编码',
    prop: 'materialCode',
    width: '214'
  },
  {
    label: '材料颜色',
    prop: 'color',
    width: '222'
  },
  {
    label: '材料名称',
    prop: 'materialName',
    width: '370'
  },
  {
    label: '规格',
    prop: 'specification'
  },
  {
    label: '单位',
    prop: 'unit'
  },
  {
    label: '加工方式',
    prop: 'processingMethod'
  },
  {
    label: '供应商',
    prop: 'supplier'
  },
  {
    label: '比例',
    prop: 'proportion'
  },
  {
    type: 'checkbox',
    label: '是否清购',
    prop: 'isClearPurchase'
  }
])
const tableData2 = ref([
  {
    materialCode: '2023-5-5002',
    color: 'red',
    materialName: '222222',
    specification: '部位1',
    unit: '分段1',
    processingMethod: '分类名称1',
    supplier: '物料编码1',
    proportion: '材料名称1',
    isClearPurchase: false
  },
  {
    materialCode: '2023-5-5002',
    color: 'red',
    materialName: '222222',
    specification: '部位1',
    unit: '分段1',
    processingMethod: '分类名称1',
    supplier: '物料编码1',
    proportion: '材料名称1',
    isClearPurchase: false
  },
  {
    materialCode: '2023-5-5002',
    color: 'red',
    materialName: '222222',
    specification: '部位1',
    unit: '分段1',
    processingMethod: '分类名称1',
    supplier: '物料编码1',
    proportion: '材料名称1',
    isClearPurchase: false
  },
  {
    materialCode: '2023-5-5002',
    color: 'red',
    materialName: '222222',
    specification: '部位1',
    unit: '分段1',
    processingMethod: '分类名称1',
    supplier: '物料编码1',
    proportion: '材料名称1',
    isClearPurchase: false
  },
  {
    materialCode: '2023-5-5002',
    color: 'red',
    materialName: '222222',
    specification: '部位1',
    unit: '分段1',
    processingMethod: '分类名称1',
    supplier: '物料编码1',
    proportion: '材料名称1',
    isClearPurchase: false
  }
])

// 分页器
const currentPage = ref(1)
const pageSize = ref(10)
const total = ref(658)
const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
</script>

<style lang="less" scoped>
// 底部
.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;

  .total {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    font-family: PingFangSC-Regular-, PingFangSC-Regular;
  }

  :deep(.el-input__wrapper) {
    padding: 0;
  }

  :deep(.el-input__suffix) {
    transform: translateX(-9px);
  }

  :deep(.el-pagination .el-select .el-input) {
    width: 88px;
  }

  :deep(.number) {
    border: 1px solid #dcdcdc;
    margin-right: 8px;
    border-radius: 3px 3px 3px 3px;
  }

  :deep(.is-active.number) {
    background-color: #f89027 !important;
    color: white;
    border-radius: 3px 3px 3px 3px;
  }

  .save {
    color: black;
    border: 1px solid #e7e7e7;
    background: #e7e7e7;
  }
}
</style>
